package com.example.ormsqlsplicingframe1.sql.impl;

import com.example.ormsqlsplicingframe1.sql.InsertSql;

import java.util.List;

public class InsertImpl implements InsertSql {

    ConditionImpl condition = new ConditionImpl();

    FieldsSql fieldsSql = new FieldsSql();

    private String table;

    @Override
    public InsertSql field(String name, Object value) {
        fieldsSql.field(name,value);
        return this;
    }

    @Override
    public String getSql() {

        String sql = "INSERT INTO "+table + fieldsSql.getInsertSql();

        return sql;
    }

    @Override
    public List<Object> getValues() {
        return fieldsSql.getValues();
    }

    @Override
    public InsertSql table(String table) {
        this.table = table;
        return  this;
    }
}
